package com.atguigu.spzx.manager.controler;


import com.atguigu.spzx.manager.service.SysFileUpdateService;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping(value = "/update")
public class FileUpdateController {

    @Autowired
    private  SysFileUpdateService sysFileUpdateService;

    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file) {
        //1 获取上传的文件
        //2 调用service的方法上传，返回minio路径
        String url = sysFileUpdateService.upload(file);
        System.out.println("我是url"+url);
        return Result.build(url, ResultCodeEnum.SUCCESS);
    }
}
